|
|
import josx.platform.rcx.*;
import josx.robotics.*;
public class LineBot3 {
public static void main(String[] args) {
Sensor.S2.setTypeAndMode(
SensorConstants.SENSOR_TYPE_LIGHT,
SensorConstants.SENSOR_MODE_PCT);
Sensor.S2.activate();
Behavior b1 = new AdjustDirection();
Behavior b2 = new MoveForward();
Behavior[] barray = {b1, b2};
Arbitrator arby = new Arbitrator(barray);
arby.start();
}
}
Note we're using classes now from the josx.robotics package, so we have to import that
We create 2 "Behavior" classes, which will be either brought forward or suppressed as the situation changes.
The behaviors are specifically put in the order they're in, so that AdjustDirection will always be first
|
|